﻿using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;

public class ads : MonoBehaviour {
	public GameObject label;
	public GameObject Boton;
	void Awake() {
		if (Advertisement.isSupported) {
			Advertisement.allowPrecache = true;
			Advertisement.Initialize ("20968");
		} else {
			Debug.Log("Platform not supported");
		}
	}
	// Use this for initialization
	void Start () {
	
	}
	public void clickAds(){
		Advertisement.Show(null, new ShowOptions {
			pause = true,
			resultCallback = result => {
				Debug.Log(result.ToString());
			}
		});
	}
	
	// Update is called once per frame
	void Update () {
		if (Advertisement.isReady ()) {
			label.SetActive(false);
			Boton.SetActive(true);
		} else {
			//label.SetActive(false);
		}
	}
	public void volver(){
		Application.LoadLevel ("Boton");
	}

	/*void OnGUI() {
		if(GUI.Button(new Rect((Screen.width/2)-75, (Screen.height/2)-25, 150, 50), Advertisement.isReady() ? "Show Ad" : "Waiting...")) {
			// Show with default zone, pause engine and print result to debug log
			Advertisement.Show(null, new ShowOptions {
				pause = true,
				resultCallback = result => {
					Debug.Log(result.ToString());
				}
			});
		}
	}*/
}
